<?php
Class User extends CI_Model
{
	function login($username, $password)
	{
		$this -> db -> select('id, username, password');
		$this -> db -> from('user');
		$this -> db -> where('username = ' . "'" . $username . "'"); 
		$this -> db -> where('password = ' . "'" . MD5($password) . "'"); 
		$this -> db -> limit(1);

		$query = $this -> db -> get();

		if($query -> num_rows() == 1)
		{
			return $query->result();
		}
		else
		{
			return false;
		}

	}
	public function add_user()
	 {
	  $data=array(
	    'username'=>$this->input->post('username'),
	    'email'=>$this->input->post('email_address'),
	    'password'=>md5($this->input->post('password'))
	  );
	  $this->db->insert('user',$data);
	 }
	 public function get_user_rs()
	 {
	 	
	 }
	 public function update_rs($data1)
	 {
	 	$email= $this->input->post('email');
	 	$this->db->where('email', $email);
		$this->db->update('user', $data1);
	 }
}

?>